﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IPagedCollectionView.cs" company="XamlNinja">
//   2011 Richard Griffin and Ollie Riches
// </copyright>
// <summary>
//   The interface paged collection view..
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WP7Contrib.Collections
{
    /// <summary>
    /// The interface paged collection view.
    /// </summary>
    /// <typeparam name="T">
    /// The type being used for binding.
    /// </typeparam>
    public interface IPagedCollectionView<T> where T : class, new()
    {
        /// <summary>
        /// Gets the current page count.
        /// </summary>
        int ItemCount { get; }

        /// <summary>
        /// Gets the total count, independent of the current page.
        /// </summary>
        int TotalItemCount { get; }

        /// <summary>
        /// Gets the current page index.
        /// </summary>
        int PageIndex { get; }

        /// <summary>
        /// Gets or sets the page size.
        /// </summary>
        int PageSize { get; set; }

        /// <summary>
        /// Gets or sets the data source.
        /// </summary>
        IPagedList<T> Source { get; }

        /// <summary>
        /// Attempts to move to first page.
        /// </summary>
        /// <returns>
        /// Returns true if moving to the first page was completed.
        /// </returns>
        bool MoveToFirstPage();

        /// <summary>
        /// Attempts to move to last page.
        /// </summary>
        /// <returns>
        /// Returns true if moving to the last page was completed.
        /// </returns>
        bool MoveToLastPage();

        /// <summary>
        /// Attempts to move to next page.
        /// </summary>
        /// <returns>
        /// Returns true if moving to the next page was completed.
        /// </returns>
        bool MoveToNextPage();

        /// <summary>
        /// Attempts to move to previous page.
        /// </summary>
        /// <returns>
        /// Returns true if moving to the previous page was completed.
        /// </returns>
        bool MoveToPreviousPage();

        /// <summary>
        /// Attempts to move to a particular page.
        /// </summary>
        /// <param name="pageIndex">
        /// The page index attempting to move to.
        /// </param>
        /// <returns>
        /// Returns true if the moving to the particular page was completed.
        /// </returns>
        bool MoveToPage(int pageIndex);

        /// <summary>
        /// Determines if a page can be moved to.
        /// </summary>
        /// <param name="pageIndex">The page index</param>
        /// <param name="pageSize">The page size</param>
        /// <returns>Returns true if we can move to the page</returns>
        bool CanMoveToPage(int pageIndex, int pageSize);

        /// <summary>
        /// Returns true if the next page can moved to.
        /// </summary>
        /// <returns>Returns true if the next page can moved to.</returns>
        bool IsThereNextPage();

        /// <summary>
        /// Returns true if the previous page can moved to.
        /// </summary>
        /// <returns>Returns true if the previous page can moved to.</returns>
        bool IsTherePreviousPage();
    }
}